document.attachEvent("onkeydown", keyboard_modaldialog);
document.attachEvent("onunload", keyboard_modaldialog_releaseMemory);

function keyboard_modaldialog(){
	var event = window.event || event;
	
	if(event.keyCode == 13){
		try{
			doSubmit();
		}catch(e){}
	}else if(event.keyCode == 27){
		try{
			cancel();
		}catch(e){
			top.close();
		}
	}
	
}

function keyboard_modaldialog_releaseMemory(){
	document.detachEvent("onkeydown", keyboard_modaldialog);
	document.detachEvent("onunload", keyboard_modaldialog_releaseMemory);
	CollectGarbage();
}

function init() {
	loginForm.username.focus();
}